import gulp from "gulp";
import path from 'path';
import fs from 'fs';
import globalLoadPlugin from 'gulp-load-plugins';
import formatter  from 'gulp-front-matter';
import del from 'del';
import runSequence from 'run-sequence';
import cleanCSS from 'gulp-clean-css';
import sourcemaps from 'gulp-sourcemaps';
import browserify from "browserify";
import source from "vinyl-source-stream";
import browserSync from 'browser-sync';
import changed from 'gulp-changed';
import htmlmin from 'gulp-htmlmin';
import sass from 'gulp-sass';
import scss from 'gulp-scss';
import autofix from 'gulp-autoprefixer';
import eslint from 'gulp-eslint';
import babel from 'gulp-babel';
import uglify from 'gulp-uglify';
import imagemin from 'gulp-imagemin';
import cache from 'gulp-cache';
import md5 from 'gulp-md5-assets';
import concat from 'gulp-concat';
import size from 'gulp-size';
import config from './gulp/pluginConfig';


const SCSS_LIBS  = path.resolve(__dirname,'libs');
const MUI_LIBS =  path.resolve(__dirname,'mui/sass');



gulp.task('default',['shop-food'],cb=>{
	console.log(MUI_LIBS);
});

gulp.task('shop-food', cb=>{
	return gulp
		.src(['./themes/shop-food/scss/**/*.scss','!./themes/shop-food/scss/**/_*.scss'])
        .pipe(sourcemaps.init())
		.pipe(scss({precision: 10}).on('error', sass.logError))
		.pipe(autofix(config.autofx))
		.pipe(size({title:"scss"}))
        .pipe(sourcemaps.write('./'))
		.pipe(gulp.dest('./themes/shop-food/css'))
		.pipe(gulp.dest('../app/themes/shop-food/dev/css'));
		//.pipe(reload({stream: true}));
});

